import { Optional } from '@nestjs/common';
import { Type } from 'class-transformer';
import { IsNotEmpty, IsInt, IsBoolean, IsDate } from 'class-validator';
import { MatchStatusEnum } from 'src/common/constant/enums';
import { EventToPlayer } from 'src/modules/event-to-player/entities/event-to-player.entity';
import { Playground } from 'src/modules/playground/entities/playground.entity';

export class CreateMatchDto {
  @Optional()
  @IsInt()
  id?: number;

  @IsInt()
  groupLoopIndex: number;

  @IsInt()
  type: number;

  @IsBoolean()
  isTeamMatch: boolean;

  @IsInt()
  homePlayer: EventToPlayer;

  @IsInt()
  awayPlayer: EventToPlayer;

  @IsInt()
  homePlayerRally: number;

  @IsInt()
  awayPlayerRally: number;

  @IsInt()
  gameRuleId: number;

  @IsInt()
  rallyRuleId: number;

  mustFinishMaxCountGame: boolean;

  mustFinishMaxCountMatch: boolean;

  @IsInt()
  createBy: number;

  @IsDate()
  createTime: Date;

  @IsInt()
  updateBy: number;

  @IsDate()
  updateTime: Date;

  @IsInt()
  fkGroupId?: number;

  @IsInt()
  fkSubMatchId?: number;

  @Type(() => Date)
  estimatedStart: Date;

  @Type(() => Date)
  estimatedEnd: Date;

  @Type(() => Date)
  actualStart: Date;

  @Type(() => Date)
  actualEnd: Date;

  playground: Playground;

  status: MatchStatusEnum;

  hasByePlayer: boolean;
}
